Skip to content

Use AbstractCASReferenceCounted to ensure entry.retain() is valid#2995

Merged
massakam merged 1 commit into
apache:masterfrom
merlimat:fix-entry-cache-refcount
Nov 19, 2018
Merged

Use AbstractCASReferenceCounted to ensure entry.retain() is valid#2995
massakam merged 1 commit into
apache:masterfrom
merlimat:fix-entry-cache-refcount

Conversation

@merlimat

Copy link
Copy Markdown
Contributor

Motivation

This will fix the root case of #2993 by using a version of AbstractReferenceCounted based on compareAndSet() rather than optimistic counter increase. This would ensure that when calling entry.retain(), if we don't get an exception the entry is guaranteed to be valid.

More detailed discussion at netty/netty#8563

@merlimat merlimat added the type/bug The PR fixed a bug or issue reported a bug label Nov 16, 2018
@merlimat merlimat added this to the 2.2.1 milestone Nov 16, 2018
@merlimat merlimat self-assigned this Nov 16, 2018
@merlimat
merlimat force-pushed the fix-entry-cache-refcount branch from 1037588 to 21a94a6 Compare November 16, 2018 01:12
@rdhabalia

Copy link
Copy Markdown
Contributor

@merlimat did you get chance to test this change with perf-producer and multiple subscription consumers.?

@merlimat

Copy link
Copy Markdown
Contributor Author

@rdhabalia No, I haven't. I think to trigger the issue also the cache need to run eviction at the same time

@merlimat

Copy link
Copy Markdown
Contributor Author

run integration tests

@massakam

Copy link
Copy Markdown
Contributor

rerun integration tests

1 similar comment
@merlimat

Copy link
Copy Markdown
Contributor Author

rerun integration tests

@sijie sijie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@merlimat shall we also adopt this in bookkeeper? since we are using that for ByteBufList. ByteBufList is a core structure in v2 protocol.

@merlimat

Copy link
Copy Markdown
Contributor Author

@merlimat shall we also adopt this in bookkeeper? since we are using that for ByteBufList. ByteBufList is a core structure in v2 protocol.

I don't think it should be a problem there because when we call increase() we always have refCnt >= 1, therefore there's never the race condition on the release() getting to 0

@merlimat

Copy link
Copy Markdown
Contributor Author

run integration tests

2 similar comments
@hrsakai

hrsakai commented Nov 18, 2018

Copy link
Copy Markdown
Contributor

run integration tests

@massakam

Copy link
Copy Markdown
Contributor

run integration tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/bug The PR fixed a bug or issue reported a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants